<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/public/header.jsp"%>
<%
    String callback = request.getParameter("callback");
%>

<html>
	<head>
		<title>新建部门账户></title>
		<style>
			.td1{
				padding-top:10px;
				padding-bottom:5px;
				font-size: 12px;
				background-color: #c0ebd7;
				width:20%;
			}
			.td2{
				padding:5px;
			}
			.tdg{
			padding-top:10px;
			padding-bottom:5px;
			font-size: 12px;
			background-color: #c0ebd7;
			width:20%;
		}
		.tdb{
			padding:5px;
			width:30%;
		}
		</style>
	</head>
	<script type="text/javascript">	
		$(function(){
			//加载部门
			$("#dept_id").combotree({
				url:'<%=contextPath %>/springMVC/group/listDepartment',
				method:'POST',
				animate:true,
				lines:true
			});
		});
		
		function doSubmit(obj){
		if($('#ff').form('validate')){
			var dept_id = $('#dept_id').combotree('getValue');
			var dept_name = $('#dept_id').combotree('getText');
			var money = $('#money').numberbox('getValue');
			var param = "dept_id="+dept_id+"&dept_name="+dept_name+"&money="+money;
			$(obj).hide();
				$.ajax({
					type:'POST',
					url:'<%=contextPath %>/springMVC/finance/addFinanceDept',
					data:param,
					success:function(rtJson){
						if (rtJson.rtState == '0'){
							eval('window.opener.<%=callback%>();');
							window.close();
						}else{
							warningInfo(rtJson.rtMsrg);
						}
					  $(obj).show();
					}
				});
			}
		}
		
	</script>
	<body>
		<form id="ff" method="POST">
		<div style="width:90%;padding-left:50px;margin-top:50px">
			<table  style="border-collapse: collapse;" width="100%" border="1px" bordercolor="#0eb83a">
				<tr>
					<td align="right"  nowrap class="td1">
						部门：
					</td>
					<td class="td2" nowrap >
						<input id="dept_id" name="dept_id" class="easyui-combotree" data-options="required:true"/>
					</td>
				</tr>
				<tr>
					<td align="right"  nowrap class="td1">
						金额：
					</td>
					<td class="td2" nowrap >
						<input id="money" name="money" class="easyui-numberbox" data-options="required:true" value='0'/>
					</td>
				</tr>
				<tr>
					<td align="right" nowrap class="td1">
					</td>
					<td  nowrap colspan="5">
						<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-save',plain:false" onclick="doSubmit(this);">保存</a>
						<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-cancel',plain:false" onclick="javascript:window.close();">关闭</a>
					</td>
				</tr>
				
 			</table>
		</div>
		</form>
	</body>
</html>
